// SearchBasic.cpp : implementation file
//

#include "stdafx.h"
#include "..\PubQQ.h"
#include "..\define\DefineComm.h"
#include "..\define\DefineUser.h"
#include "..\define\DefineList.h"
#include "SearchBasic.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CSearchBasic dialog

CSearchBasic::CSearchBasic(CWnd* pParent /*=NULL*/)
	: CDialogSN(CSearchBasic::IDD, pParent)
{
	//{{AFX_DATA_INIT(CSearchBasic)
	m_UserID = 0;
	m_UserName = _T("");
	//}}AFX_DATA_INIT
}


void CSearchBasic::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CSearchBasic)
	DDX_Text(pDX, IDC_EDIT_USERID, m_UserID);
	DDX_Text(pDX, IDC_EDIT_USERNAME, m_UserName);
	DDV_MaxChars(pDX, m_UserName, 24);
	//}}AFX_DATA_MAP

}


BEGIN_MESSAGE_MAP(CSearchBasic, CDialog)
	//{{AFX_MSG_MAP(CSearchBasic)
	ON_WM_DESTROY()
	ON_WM_CTLCOLOR()
	ON_WM_ERASEBKGND()
	ON_EN_CHANGE(IDC_EDIT_USERID, OnChangeEditUserid)
	ON_EN_CHANGE(IDC_EDIT_USERNAME, OnChangeEditUsername)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSearchBasic message handlers
BOOL CSearchBasic::PreTranslateMessage(MSG* pMsg) 
{
	// TODO: Add your specialized code here and/or call the base class
	if (pMsg->message >= WM_KEYFIRST && pMsg->message <= WM_KEYLAST)		
	{		
		if (pMsg->wParam == VK_RETURN)			
		{			
			return TRUE;			
		}		
		else if (pMsg->wParam == VK_ESCAPE)			
		{  	
			return TRUE;			
		}		
	}		
	return CDialog::PreTranslateMessage(pMsg);
}

void CSearchBasic::OnChangeEditUserid() 
{
	UpdateData();
	searchMessage.m_searchAccur.userId=m_UserID;	
}

void CSearchBasic::OnChangeEditUsername() 
{
	UpdateData();
	strcpy(searchMessage.m_searchAccur.userName,m_UserName);
}
